﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.Entity;
using Common.Facade.Interface;
using Common.Business;

namespace Common.Facade.Presenter
{
    public abstract class EditPresenter : Presenter
    {
        public IBLLClass BLLClass;

        public IModelBase ModelKey { get; set; }

        public IView ViewModel { get; set; }

        public abstract void RegistrBLLClass();

        public abstract void ControlBind(IModelBase model);
        
        public override void Initialization()
        {
            RegistrBLLClass();
            if (!ViewModel.IsPostBack)
            {
                if (ModelKey != null)
                {
                    IModelBase model = GetModel(ModelKey);
                    ControlBind(model);
                }
            }
        }

        public abstract IModelBase GetModel(IModelBase key);
        public abstract IModelBase GetModelByClient();
    }
}
